import axios from "axios";

const _host = 'http://localhost';
const _port = 8080;

export const httpGet = (_url, _params={}) => {
	return axios({
		method: 'get',
		url: `${_host}:${_port}${_url}`,
		params: _params
	}).then((res) => {
		return {
			'data': res.data,
			'statusCode': res.status
		}
	}).catch((err) => {
		return {
			'data': err.message,
			'statusCode': 0
		}
	})
}

export const httpPost = (_url, _data={}) => {
	return axios({
		method: 'post',
		url: `${_host}:${_port}${_url}`,
		data: _data
	}).then((res) => {
		return {
			'data': res.data,
			'statusCode': res.status
		}
	}).catch((err) => {
		return {
			'data': err.message,
			'statusCode': 0
		}
	})
}
